import { SET_USERINFO } from './actionType'

export const setUserInfo = userInfo => {
  // 返回action对象
  return {
    type: SET_USERINFO,
    userInfo
  }
}

export const asyncSetUserInfo = userInfo => {
  // 异步的action中返回的必须是函数
  return dispatch => {
    setTimeout(() => {
      dispatch(setUserInfo(userInfo))
    }, 2000)
  }
}
